package entity;

import java.io.*;
import java.util.ArrayList;

/**
 * 用户类 - User.txt文件中内容
 */
public class User {
    private int id;
    private String password;
    private String name;
    private long telephone;
    private String email;

    public User() throws IOException {

    }


    public User(int id, String password, String name, long telephone, String email) {
        this.id = id;
        this.password = password;
        this.name = name;
        this.telephone = telephone;
        this.email = email;
    }

    /*public static void main(String[] args) throws IOException {
        String path = User.class.getClassLoader().getResource("util/user.txt").getPath();
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
        ArrayList<User> list = new ArrayList<>();
        String s = br.readLine();
        while (s!=null){
            String[] user=s.split(":");
            int id=Integer.parseInt(user[0]);
            String password=user[1];
            String name=user[2];
            long telephone=Long.parseLong(user[3]);
            String email=user[4];
            User user1 = new User(id,password,name,telephone,email);
            list.add(user1);
            s=br.readLine();
        }
        br.close();
        for (User u:list) {
            System.out.println(u);
        }
    }*/

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getTelephone() {
        return telephone;
    }

    public void setTelephone(int telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", password='" + password + '\'' +
                ", name='" + name + '\'' +
                ", telephone=" + telephone +
                ", email='" + email + '\'' +
                '}';
    }
    // id
    // password
    // name
    // telephone
    // email
}
